package org.example.demo.entity;

import com.kfyang.manualgear.annotation.crud.Construct;
import com.kfyang.manualgear.annotation.orm.LogicalDelete;
import com.kfyang.manualgear.annotation.orm.NotCol;
import com.kfyang.manualgear.annotation.orm.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.example.demo.base.BaseEntity;

import java.util.Date;


@EqualsAndHashCode(callSuper = true)
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Table("`order`")
public class OrderEntity extends BaseEntity {

    private String orderName;
    private Date orderDate;
    private Integer customerId;

    @LogicalDelete
    private Integer isDeleted;

    @NotCol
    private Ticket ticket;

    static class Ticket {
        private Integer price;
    }

    @Construct("o1")
    public OrderEntity(Integer id, String orderName, Date orderDate, Integer customerId) {
        this.id = id;
        this.orderName = orderName;
        this.orderDate = orderDate;
        this.customerId = customerId;
    }
}
